package com.jett.JChatServer;

import com.jett.JChatMsg.BO.Message;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;

public class BootStrap {
    private static final int JCHATSEVER_PORT = 9999;
    private static final int MAX_READ_LEN = 1024 * 1024;

    public static void main(String[] args) throws IOException, ClassNotFoundException {
/**
 * 创建socketserver
 */
        ServerSocket serverSocket = new ServerSocket();
        /**
         *  端口绑定
         */
        System.out.println("Listen Port:" + JCHATSEVER_PORT);
        serverSocket.bind(new InetSocketAddress(JCHATSEVER_PORT));

        Socket socket = serverSocket.accept();
        InputStream inputStream = socket.getInputStream();

        ObjectInputStream ois = new ObjectInputStream(inputStream);
        Message o = (Message) ois.readObject();
        System.out.println(o);
        inputStream.close();

    }
}
